package com.yingxin.yx.framework.commons.activiti.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.yingxin.yx.framework.commons.activiti.ApprovalStatusHelper;
import com.yingxin.yx.framework.commons.activiti.def.TaskActionDef;
import com.yingxin.yx.framework.commons.dto.AttachmentDto;
import com.yingxin.yx.framework.commons.vo.ActivitCoreInformationRespVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
public class ActivitiInstanceDto implements Serializable {

    private static final long serialVersionUID = 1L;

    private String id;

    @ApiModelProperty(value = "任务id")
    private String taskId;

    @ApiModelProperty(value = "任务名称")
    private String taskName;

    @ApiModelProperty(value = "审批人id")
    private String assigneeId;

    @ApiModelProperty(value = "审批人名称")
    private String assigneeName;

    @ApiModelProperty(value = "审批人处理时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private Date assigneeProcessingTime;

    @ApiModelProperty(value = "审批人意见")
    private String assigneeComment;

    @ApiModelProperty(value = "0 审核中  1 审核通过  -1 审核不通过 ")
    private String taskApprovalStatus;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    protected Date createTime;

    private String deleteReason;

    // 操作定义，主要用途是改名
    private List<TaskActionDef> actionDefList;

    // 用户可用操作
    private List<String> actions = new ArrayList<>();

    private String processInstanceId;

    @ApiModelProperty(value = "申请人id")
    private String applicantId;

    @ApiModelProperty(value = "申请人名称")
    private String applicantName;

    @ApiModelProperty(value = "申请时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private Date applicationTime;

    @ApiModelProperty(value = "单据类型")
    private String billType;

    @ApiModelProperty(value = "单据id")
    private String billId;

    @ApiModelProperty(value = "单据编号")
    private String billNo;

    @ApiModelProperty(value = "0 默认页面  10 只能查看")
    private String formKey;

    @ApiModelProperty(value = "进项减少 ")
    private String incomeSubtract;

    @ApiModelProperty(value = "是否APP审核 ")
    private String isAppApproval;

    @ApiModelProperty(value = "0 审核中  1 审核通过  -1 审核不通过 ")
    private String processApprovalStatus;

    @ApiModelProperty("可撤销的")
    private String revocable;

    @ApiModelProperty("是否代办待确认")
    private String isReplace;

    @ApiModelProperty("自定义表单")
    private String customFormId;

    private String customFormContent;

    @ApiModelProperty(value = "流程任务")
    private List<ActivitiInstanceDto> hitTasks;

    // 审核人签名
    private String assigneeSignUrl;

    @ApiModelProperty(value = "附件")
    private List<AttachmentDto> taskAttachmentList;

    @ApiModelProperty(value = "单据类型名称")
    private String billTypeName;

    public String getBusinessId() {
        return billId;
    }

    public String getBusinessNo() {
        return billNo;
    }

    public String getBusinessType() {
        return billType;
    }

    public String getTaskApprovalStatusName() {
        return ApprovalStatusHelper.getName(taskApprovalStatus);
    }

    public String getProcessApprovalStatusName() {
        return ApprovalStatusHelper.getName(processApprovalStatus);
    }

    /**
     * 当前审核人信息
     */
    private String currentAssigneeInfo;

    /**
     * app 手机端待审核列表核心信息集合
     */
    private List<ActivitCoreInformationRespVo> activitCoreInformationRespVos;

}